<!doctype html>
<html lang="zh-CN" th:replace="admin-layout :: layout(~{::title}, ~{}, ~{::script}, ~{::body}, 'classify-list')"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <title th:text="${data}?'修改分类':_">添加分类</title>
    <script th:inline="javascript">
        $("#submitBtn").click(function(){
            ajaxJson("/admin/classify/ajax/save",$("#form").serialize(),function(res){
                if(res.status){
                    location.href="/admin/classify/list";
                }
            })
        })
    </script>
</head>
<body>
<!--<ol class="breadcrumb">
    <li><a th:href="@{/admin/classify/list}">分类列表</a></li>
    <li class="active"th:text="${data}?'修改分类':_">添加分类</li>
</ol>-->
<form class="form-horizontal" id="form">
    <input type="hidden" name="id" th:if="${data}" th:value="${data.id}">
    <div class="form-group">
        <label class="col-sm-2 col-md-2 col-lg-3 control-label"><span class="text-danger">*&nbsp;</span>分类名称</label>
        <div class="col-sm-8 col-md-8 col-lg-6">
            <input type="text" class="form-control" placeholder="分类名称" name="name" th:value="${data}?${data.name}">
        </div>
    </div>
    <div class="form-group hidden" th:if="${data}==null">
        <label class="col-sm-2 col-md-2 col-lg-3 control-label"><span class="text-danger">*&nbsp;</span>分类类型</label>
        <div class="col-sm-8 col-md-8 col-lg-6">
            <select name="dataType" class="form-control">
                <option value="0" th:selected="${data}?${data.dataType}==0">试题</option>
            </select>
        </div>
    </div>
    <div class="form-group hidden" th:if="${data}!=null">
        <label class="col-sm-2 col-md-2 col-lg-3 control-label"><span class="text-danger">*&nbsp;</span>分类类型</label>
        <div class="col-sm-8 col-md-8 col-lg-6" th:switch="${data.dataType}">
            <p class="form-control-static" th:case="0">试题</p>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-md-offset-2 col-lg-offset-3 col-sm-8 col-md-8 col-lg-6">
            <button type="button" class="btn btn-primary" id="submitBtn">提交</button>
            <button type="button" class="btn btn-warning backBtn">返回</button>
        </div>
    </div>
</form>
</body>
</html>